<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		
		<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
		<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
		<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
		<meta name="viewport" content="width=device-width; initial-scale=1.0" />

		
	</head>

	<body>
	
		<div data-role="page"  data-theme="b">
			
			<header data-tap-toggle="false" data-position="fixed" data-role="header" role="banner">
				
				<a href="#menuPanel" data-role="button" data-icon="bars" data-iconpos="notext" data-theme="b" data-inline="true">Bars</a>
				
				<h1 id="centerheader">
					<a href="main.html">
						<!-- <img src="img/aa.png" alt="" /> -->
					</a>
				</h1>
				<h5>${sessionScope.userLoginInfo.name}님 환영합니다.</h5>
				<a href="#rightpanel" data-role="button" data-icon="grid" data-iconpos="notext" data-theme="b" data-inline="true">Grid</a>
				
			</header>
							
			
			
			<section id="menuPanel" data-display="overlay" data-position-fixed="true" data-role="panel"  data-theme="b">
			<div class="ui-panel-inner" ><nav class="main-nav">
				<ul class="menupanel_one">
					<li>
					<a href="main" data-lid="home" class="ui-link active">MAIN</a>
					</li>
					
					<li>
					<a data-lid="vehicles" class="ui-link">업무보고</a>
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="reportingregist" data-lid="mobile_apps" class="ui-link">등 록</a>
							</li>
							<li>
								<a href="todayreporting" data-lid="mobile_apps" class="ui-link">일일업무</a>
							</li>
							<li>
								<a href="weekreporting" data-lid="mobile_apps" class="ui-link">주간업무</a>
							</li>
							<li>
								<a href="monthreporting" data-lid="mobile_apps" class="ui-link">월간업무</a>
							</li>
						</ul>
					<li>
						
					<a data-lid="vehicles" class="ui-link">회의록</a>
					
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="minutesregist" data-lid="mobile_apps" class="ui-link">등 록</a>
							</li>
							<li>
								<a href="minuteslist" data-lid="mobile_apps" class="ui-link">지난 회의록</a>
							</li>
						</ul>
				
					<li>
						<a data-lid="mobile_apps" class="ui-link">거래처 관리</a>
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="accountlist" data-lid="mobile_apps" class="ui-link">거래처 보기</a>
							</li>
							<li>
								<a href="accountregist" data-lid="mobile_apps" class="ui-link">거래처 등록</a>
							</li>							
						</ul>
					
					<li>
						<a href="location" data-lid="owner_site" >팀원 위치 보기</a>
					</li>
					
					<li>
						<a href="#companybbs" data-lid="owner_site" >사내 게시판</a>
					</li>
						
					<li>
						<a href="teambbslist" data-lid="mobile_apps" class="ui-link"  rel='external' >팀 게시판</a>
					</li>
						
					<li>
						<a data-lid="owner_site" >PT</a>
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="ptregist" data-lid="mobile_apps" class="ui-link">등 록</a>
							</li>
							<li>
								<a href="ptview" data-lid="mobile_apps" class="ui-link">보 기</a>
							</li>							
						</ul>
					
				</ul>
				</nav></div>
			</section>	
			
			
			
					
			<div data-role="panel" id="rightpanel" data-display="overlay" data-position="right" data-theme="b">
				
			</div>
			
			
			
			<div data-role="content" class="ui-panel-content-wrap">
			 
			 	<div>
	<header>
		<h1>팀게시판</h1>
	</header>
	
	<div class="menubtn">
		<a href="teambbsregist" class="btn1">글쓰기</a>
		<a href="main" class="btn2">메인으로</a>
	</div>
	 	 
			<div class ="teamList">
					<div data-role="collapsible-set" data-theme="c" data-content-theme="d">				

						 
			<div data-role="collapsible"><h2>공지사항</h2>
		        
		        <ul data-role="listview" data-theme="d" data-divider-theme="d">
		           
		           	<c:forEach items="${requestScope.tNoticeList }" var="tNoticeList">
		            <li data-role="list-divider">${tNoticeList.name }<strong>&nbsp;<${tNoticeList.regdate }></strong><span class="ui-li-count">${tNoticeList.viewCnt }</span></li>
		            
			            <li><a href="">
			                    <p><strong>${tNoticeList.title } </strong></p>
			                    <p class="ui-li-aside"><span class="ui-li-count">${tNoticeList.replyCnt }</span></p>
			            </a></li>
		            </c:forEach>
		            
		        </ul>
		    </div>			 
						 
		    <div data-role="collapsible"><h2>일반글</h2>
		        
		        <ul data-role="listview" data-theme="d">
		           
		           	<c:forEach items="${requestScope.tBbsList }" begin="1" end="20" var="tList" varStatus="status">
			            <li><a href="teambbsview?seqno=${tList.seqno }&writer=${tList.writer }&departCode=${tList.departCode } "  rel="external" class="listTitle">
			                    <p><strong>${tList.title }&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;</strong><strong>${tList.name }</strong><strong>&nbsp;<${tList.regdate }></strong><span class="ui-li-count">${tList.viewCnt }</span> </p>
			                    <p class="ui-li-aside"><span class="ui-li-count">${tList.replyCnt }</span></p>
			            </a></li>
					<input type="hidden" id="totalCount" value=${tList.totalCount } />
		            </c:forEach>
		            
		        </ul>
		    </div>
		    
		</div>
							 
	</div>
</div>

	<div id="paging"></div>
				
	<!-- 검색 -->
	<div class="searchDiv">
		<form method="get">
			<div class="selectContainerStyled">
		        <select name="keywordType" id="keywordType">
		            <option value="content">내용</option>
		            <option value="title">제목</option>
		            <option value="writer">작성자</option>
		        </select>
		    </div>
			<input type="hidden" name="page" id="page" value=${tCri.page } />
			
			
			<div class="ui-block-a"><input type="text" name="keyword" id="keyword" value="${tCri.keyword }" data-inline="true" placeholder="검색어를 입력하세요"></div>
		    <div class="ui-block-b"><button type="submit" data-theme="a">검색</button></div>
		</form>
	</div>
</div>
				
</div> <!-- page -->




<style>

body{
overflow: hidden;
}

.paging{
margin-left: 30%;
}
</style>
			
<script>
				
//////////////////////////////////////////////////////////////////////////////


 
 //////////////페이징//////////////////////

 /* <a href="#" data-role="button" id="preBtn" data-icon="arrow-l" data-iconpos="left" data-inline="true">이전</a> 
<span><strong>1 ~ 20</strong></span>
<a href="#" data-role="button" id="nextBtn" data-icon="arrow-r" data-iconpos="right" data-inline="true">다음</a> */

   function page(currentPage){
	 
	console.log(currentPage);
	console.log($('#page').val());
	console.log($('#totalCount').val());
	
	var next = Number(currentPage) +1 ;
	var prev = Number(currentPage) -1 ;
	var totalCount = $('#totalCount').val();
	
	var button = "";
	
	if(currentPage > 1){
		button += "<a href='teambbslist?page="+prev+"' rel='external' data-role='button' id='preBtn' data-icon='arrow-l' data-iconpos='left' data-inline='true'>이전</a>";
	}
		button += "<span><strong>"+(currentPage*20-19)+" ~ "+(currentPage*20)+"</strong></span>";
	if(totalCount = 21){
		button +="<a href='teambbslist?page="+next+"' rel='external' data-role='button' id='nextBtn' data-icon='arrow-r' data-iconpos='right' data-inline='true'>다음</a>";
	}
		$('#paging').html(button);	
	 
 }


   page($('#page').val());  


</script>
</body>
</html>